package BVRClient;

import org.newdawn.slick.AppGameContainer;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.StateBasedGame;

/**
 * The Blue vs Red: Arena Game Client.
 * @author Jesse Gill
 * @author Shannon Setter
 */
public class BVRC_GameClient extends StateBasedGame
{
	private static final String CURRENT_VERSION = "0.0.1";
	private static final int MAIN_MENU_STATE = 0;
	private static final int GAMEPLAY_STATE = 1;
	
	private static AppGameContainer app = null;
	
	/**
	 * Constructor that sets the game title.
	 * @param title
	 */
	public BVRC_GameClient(String title)
	{
		super(title);
		
		this.addState(new BVRC_MainMenuState(MAIN_MENU_STATE));
		this.addState(new BVRC_GamePlayState(GAMEPLAY_STATE));
        this.enterState(GAMEPLAY_STATE);
	}

	/**
	 * Initial function that runs.
	 * @param args
	 */
	public static void main(String[] args)
	{
		try
		{
			app = new AppGameContainer(new BVRC_GameClient("Blue vs Red: Arena - Build:" + CURRENT_VERSION));
			app.setDisplayMode(1024, 768, false);
			app.setTargetFrameRate(60);
			app.setAlwaysRender(true);
	        app.start();
		}
		catch (SlickException e)
		{
			e.printStackTrace();
		}
	}
	
	/**
	 * @param gc
	 */
	@Override
	public void initStatesList(GameContainer gc) throws SlickException
	{
		this.getState(MAIN_MENU_STATE).init(gc, this);
		this.getState(GAMEPLAY_STATE).init(gc, this);
	}
}
